using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;
using DSEngine.Core;
using DSEngine.Common;

namespace DSEngine
{
    public sealed class DSEngine
    {
        private static DSEngine engine;
        public static void InitEngine(Game g)
        {
            engine = new DSEngine(g);
           
        }
        public static DSEngine Instance
        {
            get
            {
                return engine;
            }
        }

        protected DSEngine(Game game)
        {
            this.GameInstance = game;
            ScreenManager = new ScreenManager(game);
            ScreenManager.Initialize();
            this.BufferWidth = game.GraphicsDevice.Viewport.Width;
            this.BufferHeight = game.GraphicsDevice.Viewport.Height;
        }

        public Game GameInstance { get;internal set; }
        public ScreenManager ScreenManager { get; internal set; }


        public void Update(GameTime gameTime)
        {
            
            ActerManager.Instance.Update(gameTime);
            SchedulerManager.Instance.Update(gameTime);
            ScreenManager.Update(gameTime);
            
        }
        public void Draw(GameTime gameTime)
        {
            ScreenManager.Draw(gameTime);
        }

        public int BufferWidth { get; set; }
        public int BufferHeight { get; set; }
    }
}
